<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<title>Inter in Text Files</title>
<link href="../docs-assets/Breadcrumbs.css" rel="stylesheet" rev="stylesheet" type="text/css">
		<meta name="viewport" content="width=device-width initial-scale=1">
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<meta http-equiv="Content-Language" content="en-gb">

<link href="../docs-assets/Contents.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Progress.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Navigation.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Fonts.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Base.css" rel="stylesheet" rev="stylesheet" type="text/css">
<script>
function togglePopup(material_id) {
  var popup = document.getElementById(material_id);
  popup.classList.toggle("show");
}
</script>

<link href="../docs-assets/Popups.css" rel="stylesheet" rev="stylesheet" type="text/css">
<link href="../docs-assets/Colours.css" rel="stylesheet" rev="stylesheet" type="text/css">
		
	</head>
	<body class="commentary-font">
		<nav role="navigation">
		<h1><a href="../index.html"><img src="../docs-assets/Inform.png" height=72> </a></h1>
<ul><li><a href="../index.html">home</a></li>
</ul><h2>Compiler</h2><ul>
<li><a href="../structure.html">structure</a></li>
<li><a href="../inbuildn.html">inbuild</a></li>
<li><a href="../inform7n.html">inform7</a></li>
<li><a href="../intern.html">inter</a></li>
<li><a href="../services.html">services</a></li>
<li><a href="../secrets.html">secrets</a></li>
</ul><h2>Other Tools</h2><ul>
<li><a href="../inblorbn.html">inblorb</a></li>
<li><a href="../inform6.html">inform6</a></li>
<li><a href="../inpolicyn.html">inpolicy</a></li>
</ul><h2>Resources</h2><ul>
<li><a href="../extensions.html">extensions</a></li>
<li><a href="../kits.html">kits</a></li>
</ul><h2>Repository</h2><ul>
<li><a href="https://github.com/ganelson/inform"><img src="../docs-assets/github.png" height=0> github</a></li>
</ul><h2>Related Projects</h2><ul>
<li><a href="https://github.com/ganelson/inweb"><img src="../docs-assets/github.png" height=0> inweb</a></li>
<li><a href="https://github.com/ganelson/intest"><img src="../docs-assets/github.png" height=0> intest</a></li>
</ul>
		</nav>
		<main role="main">
		<!-- Weave of 'Inter in Text Files' generated by inweb -->
<div class="breadcrumbs">
    <ul class="crumbs"><li><a href="../index.html">Home</a></li><li><a href="../intern.html">Inter Modules</a></li><li><a href="index.html">bytecode</a></li><li><a href="index.html#3">Chapter 3: Their Instructions</a></li><li><b>Inter in Text Files</b></li></ul></div>
<p class="purpose">To read a tree from a file written in the plain text version of Inter.</p>

<ul class="toc"><li><a href="3-iitf.html#SP1">&#167;1. Reading textual inter</a></li><li><a href="3-iitf.html#SP4">&#167;4. Utility functions for parsing construct lines</a></li><li><a href="3-iitf.html#SP7">&#167;7. Forward references</a></li><li><a href="3-iitf.html#SP8">&#167;8. Writing textual inter</a></li><li><a href="3-iitf.html#SP10">&#167;10. Utility functions for writing construct lines</a></li><li><a href="3-iitf.html#SP11">&#167;11. Notation for text literals</a></li><li><a href="3-iitf.html#SP12">&#167;12. Notation for value pairs</a></li><li><a href="3-iitf.html#SP13">&#167;13. Bracketed type markers</a></li></ul><hr class="tocbar">

<p class="commentary firstcommentary"><a id="SP1" class="paragraph-anchor"></a><b>&#167;1. Reading textual inter.</b>The test group <span class="extract"><span class="extract-syntax">:syntax</span></span> of Inter test cases may be useful in checking
the code below. Anyway, here we import the content of the file <span class="extract"><span class="extract-syntax">F</span></span> into the
tree <span class="extract"><span class="extract-syntax">I</span></span>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::read</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">filename</span><span class="plain-syntax"> *</span><span class="identifier-syntax">F</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOGIF</span><span class="plain-syntax">(</span><span class="identifier-syntax">INTER_FILE_READ</span><span class="plain-syntax">, </span><span class="string-syntax">"Reading textual inter file %f\n"</span><span class="plain-syntax">, </span><span class="identifier-syntax">F</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP18" class="function-link"><span class="function-syntax">InterInstruction::suspend_cross_referencing</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">irl_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">irl</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">irl</span><span class="plain-syntax">.</span><span class="element-syntax">no_blank_lines_stacked</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> </span><span class="identifier-syntax">IBM</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP4" class="function-link"><span class="function-syntax">InterBookmark::at_start_of_this_repository</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">irl</span><span class="plain-syntax">.</span><span class="element-syntax">write_pos</span><span class="plain-syntax"> = &amp;</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">TextFiles::read</span><span class="plain-syntax">(</span><span class="identifier-syntax">F</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="string-syntax">"can't open inter file"</span><span class="plain-syntax">, </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-iitf.html#SP2" class="function-link"><span class="function-syntax">TextualInter::read_line</span></a><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">irl</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP7" class="function-link"><span class="function-syntax">TextualInter::resolve_forward_references</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Primitives::index_primitives_in_tree</span><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP18" class="function-link"><span class="function-syntax">InterInstruction::resume_cross_referencing</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-ic.html#SP7" class="function-link"><span class="function-syntax">InterInstruction::tree_lint</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP2" class="paragraph-anchor"></a><b>&#167;2. </b>This fussy little mechanism passes each line of the text file to
<a href="3-iitf.html#SP3" class="internal">TextualInter::parse_single_line</a>, except that it omits any run of blank
lines at the end. (Most text files technically have one blank line at the end
without anyone realising it.) By blank, we mean completely devoid of characters:
a line containing spaces or tabs is not blank in this sense.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">irl_state</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">no_blank_lines_stacked</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">irl_state</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::read_line</span><button class="popup" onclick="togglePopup('usagePopup1')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup1">Usage of <span class="code-font"><span class="function-syntax">TextualInter::read_line</span></span>:<br/><a href="3-iitf.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_file_position</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tfp</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">irl_state</span><span class="plain-syntax"> *</span><span class="identifier-syntax">irl</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">irl_state</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> </span><span class="identifier-syntax">eloc</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP2" class="function-link"><span class="function-syntax">InterErrors::file_location</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) { </span><span class="identifier-syntax">irl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_blank_lines_stacked</span><span class="plain-syntax">++; </span><span class="reserved-syntax">return</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;irl-&gt;</span><span class="element-syntax">no_blank_lines_stacked</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> </span><span class="identifier-syntax">b_eloc</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP2" class="function-link"><span class="function-syntax">InterErrors::file_location</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">""</span><span class="plain-syntax">, </span><span class="identifier-syntax">tfp</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP3" class="function-link"><span class="function-syntax">TextualInter::parse_single_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">(), &amp;</span><span class="identifier-syntax">b_eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">irl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">write_pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><a href="3-ie.html#SP5" class="function-link"><span class="function-syntax">InterErrors::issue</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">irl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">no_blank_lines_stacked</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">        </span><a href="3-iitf.html#SP3" class="function-link"><span class="function-syntax">TextualInter::parse_single_line</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">line</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">irl</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">write_pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><a href="3-ie.html#SP5" class="function-link"><span class="function-syntax">InterErrors::issue</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure irl_state is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP3" class="paragraph-anchor"></a><b>&#167;3. </b>The following is called not only by the above but also when creating primitives.
See <a href="../building-module/1-ip.html" class="internal">Inter Primitives (in building)</a>.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">match_results</span><span class="plain-syntax"> </span><span class="identifier-syntax">mr</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">inter_annotation_set</span><span class="plain-syntax"> </span><span class="identifier-syntax">set</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">indent_level</span><span class="plain-syntax">;</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax">;</span>

<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::parse_single_line</span><button class="popup" onclick="togglePopup('usagePopup2')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup2">Usage of <span class="code-font"><span class="function-syntax">TextualInter::parse_single_line</span></span>:<br/><a href="3-iitf.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_line_parse</span><span class="plain-syntax"> </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax"> = </span><span class="identifier-syntax">line</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">mr</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Regexp::create_mr</span><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">set</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP10" class="function-link"><span class="function-syntax">SymbolAnnotation::new_annotation_set</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">indent_level</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP3_1" class="named-paragraph-link"><span class="named-paragraph">Find indentation</span><span class="named-paragraph-number">3.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP3_2" class="named-paragraph-link"><span class="named-paragraph">If the indentation is now lower than expected, move the write position up the tree</span><span class="named-paragraph-number">3.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP3_3" class="named-paragraph-link"><span class="named-paragraph">Parse any annotations at the end of the line</span><span class="named-paragraph-number">3.3</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ic.html#SP21" class="function-link"><span class="function-syntax">InterInstruction::match</span></a><span class="plain-syntax">(&amp;</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<ul class="endnotetexts"><li>The structure inter_line_parse is accessed in 3/ic, 4/tcc, 4/tcc2, 4/tic, 4/tic2, 4/toc, 4/tpc, 4/tpc2, 4/tpc3, 4/tpc4, 4/tpc5, 4/tpc6, 4/tpc7, 4/tpc8, 4/ttc, 4/tvc, 5/tac, 5/tcc, 5/tcc2, 5/tec, 5/tic, 5/tlc, 5/tlc2, 5/tlc3, 5/trc, 5/trc2, 5/tsc, 5/tvc, 6/tpc, 6/tsc, 6/tvc and here.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_1" class="paragraph-anchor"></a><b>&#167;3.1. </b>We are a bit aggressive in requiring the Python-style indentation at the start
of each line to be made of tabs, not spaces. If we intended textual Inter to be
a programming language for humans to use, we might be more accommodating. But it's
really an interchange format for programs to use.
</p>

<p class="commentary">A blank line is treated as a comment, so we rewrite it with the explicit <span class="extract"><span class="extract-syntax">#</span></span>
notation. If it is printed back, it will actually be printed back as empty
anyway &mdash; see <a href="4-tcc.html#SP5" class="internal">CommentInstruction::write</a>. So nobody will ever know our little
deception.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Find indentation</span><span class="named-paragraph-number">3.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'\t'</span><span class="plain-syntax">) </span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">indent_level</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">' '</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::plain</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">I</span><span class="string-syntax">"spaces (rather than tabs) at beginning of line"</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">Str::trim_white_space</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="character-syntax">'#'</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_2" class="paragraph-anchor"></a><b>&#167;3.2. </b>So suppose the write position is in a package where the contents are at
level 7 in the tree hierarchy, but we seem to be reading a line with indentation
5, and which therefore wants to put an instruction in at level 5. This means it
is intended not for the current package but for the parent of the parent of
that package, so we take two steps upwards in the tree.
</p>

<p class="commentary">After doing all this, then, the write position is in the correct package for
where the node is asking to go. (And if the indentation was 0, that will be the
root package of the tree.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">If the indentation is now lower than expected, move the write position up the tree</span><span class="named-paragraph-number">3.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">        (</span><a href="2-pck.html#SP15" class="function-link"><span class="function-syntax">InterPackage::is_a_root_package</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">)) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">        (</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">indent_level</span><span class="plain-syntax"> &lt;= </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::baseline</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">)))</span>
<span class="plain-syntax">        </span><a href="2-bkm.html#SP5" class="function-link"><span class="function-syntax">InterBookmark::move_into_package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">,</span>
<span class="plain-syntax">            </span><a href="2-pck.html#SP5" class="function-link"><span class="function-syntax">InterPackage::parent</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP6" class="function-link"><span class="function-syntax">InterBookmark::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">)));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP3_3" class="paragraph-anchor"></a><b>&#167;3.3. </b>A line ending, e.g., <span class="extract"><span class="extract-syntax">... _bar _foo=2</span></span> has those annotations parsed and trimmed
away. The result of the parsing goes into the annotation set <span class="extract"><span class="extract-syntax">ilp.set</span></span>. Note
that we do nothing with that result here &mdash; it will be up to the <span class="extract"><span class="extract-syntax">CONSTRUCT_READ_MTID</span></span>
method for the construct used on the line to make use of the set, or not, as it
pleases.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse any annotations at the end of the line</span><span class="named-paragraph-number">3.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">quoted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">, </span><span class="identifier-syntax">cutoff</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">); </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) </span><span class="identifier-syntax">quoted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">quoted</span><span class="plain-syntax">?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'\\'</span><span class="plain-syntax">) </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">quoted</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">0</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">Characters::is_whitespace</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1))) &amp;&amp;</span>
<span class="plain-syntax">            (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'_'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1) == </span><span class="character-syntax">'_'</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cutoff</span><span class="plain-syntax"> == -1) </span><span class="identifier-syntax">cutoff</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">annot</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">while</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">i</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                ((</span><span class="identifier-syntax">quoted</span><span class="plain-syntax">) ||</span>
<span class="plain-syntax">                    (</span><span class="identifier-syntax">Characters::is_whitespace</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">)) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">-1) != </span><span class="character-syntax">'\\'</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                    </span><span class="identifier-syntax">quoted</span><span class="plain-syntax"> = </span><span class="identifier-syntax">quoted</span><span class="plain-syntax">?</span><span class="identifier-syntax">FALSE:TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">annot</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">i</span><span class="plain-syntax">++;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">inter_annotation</span><span class="plain-syntax"> </span><span class="identifier-syntax">IA</span><span class="plain-syntax"> = </span><a href="2-ann.html#SP15" class="function-link"><span class="function-syntax">SymbolAnnotation::read_annotation</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">                </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">write_pos</span><span class="plain-syntax">), </span><span class="identifier-syntax">annot</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><a href="2-ann.html#SP11" class="function-link"><span class="function-syntax">SymbolAnnotation::write_to_set</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IA</span><span class="plain-syntax">.</span><span class="element-syntax">annot</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">iatype</span><span class="plain-syntax">, &amp;(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">set</span><span class="plain-syntax">), </span><span class="identifier-syntax">IA</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">annot</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">cutoff</span><span class="plain-syntax"> &gt;= </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::put_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">ilp</span><span class="plain-syntax">.</span><span class="element-syntax">line</span><span class="plain-syntax">, </span><span class="identifier-syntax">cutoff</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP3">&#167;3</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP4" class="paragraph-anchor"></a><b>&#167;4. Utility functions for parsing construct lines.</b>First, the following tries to make a symbol with a given name in the given
scope; the name must currently be free, or an error is generated.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::new_symbol</span><button class="popup" onclick="togglePopup('usagePopup3')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup3">Usage of <span class="code-font"><span class="function-syntax">TextualInter::new_symbol</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP6_1">&#167;6.1</a><br/>The Instance Construct - <a href="4-tic2.html#SP4_2">&#167;4.2</a><br/>The Origin Construct - <a href="4-toc.html#SP4">&#167;4</a><br/>The Package Construct - <a href="4-tpc.html#SP4">&#167;4</a><br/>The PackageType Construct - <a href="4-tpc2.html#SP3">&#167;3</a><br/>The Primitive Construct - <a href="4-tpc5.html#SP4">&#167;4</a><br/>The Property Construct - <a href="4-tpc6.html#SP4">&#167;4</a><br/>The Typename Construct - <a href="4-ttc.html#SP4">&#167;4</a><br/>The Variable Construct - <a href="4-tvc.html#SP4">&#167;4</a><br/>The Lab Construct - <a href="5-tlc.html#SP4">&#167;4</a><br/>The Label Construct - <a href="5-tlc2.html#SP4">&#167;4</a><br/>The Local Construct - <a href="5-tlc3.html#SP4">&#167;4</a><br/>The Plug Construct - <a href="6-tpc.html#SP2">&#167;2</a><br/>The Socket Construct - <a href="6-tsc.html#SP2">&#167;2</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP9" class="function-link"><span class="function-syntax">InterSymbol::misc_but_undefined</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"symbol already exists"</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="2-st.html#SP9" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name_creating</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5" class="paragraph-anchor"></a><b>&#167;5. </b>Second, this attempts to match a name against a symbol in the scope local to
the bookmark <span class="extract"><span class="extract-syntax">IBM</span></span>. If it exists, we return it, though if <span class="extract"><span class="extract-syntax">construct</span></span> is non-zero
then we first check if it is defined by an instruction of that type. (This
enables us to tell if it's, e.g., a variable, defined by <span class="extract"><span class="extract-syntax">VARIABLE_IST</span></span> instruction.)
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::find_symbol</span><button class="popup" onclick="togglePopup('usagePopup4')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup4">Usage of <span class="code-font"><span class="function-syntax">TextualInter::find_symbol</span></span>:<br/>The Permission Construct - <a href="4-tpc3.html#SP4">&#167;4</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP4">&#167;4</a><br/>The Typename Construct - <a href="4-ttc.html#SP4">&#167;4</a><br/>The Inv Construct - <a href="5-tic.html#SP7_3">&#167;7.3</a><br/>The Val Construct - <a href="5-tvc.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">construct</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-iitf.html#SP5" class="function-link"><span class="function-syntax">TextualInter::find_symbol_in_table</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">construct</span><span class="plain-syntax">, </span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::find_symbol_in_table</span><button class="popup" onclick="togglePopup('usagePopup5')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup5">Usage of <span class="code-font"><span class="function-syntax">TextualInter::find_symbol_in_table</span></span>:<br/>Inter Data Types - <a href="3-idt.html#SP18_12">&#167;18.12</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">construct</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">name</span><span class="plain-syntax">) == </span><span class="character-syntax">'/'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP5_1" class="named-paragraph-link"><span class="named-paragraph">Search using URL conventions</span><span class="named-paragraph-number">5.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"no such symbol"</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">construct</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Check that it is defined by the correct construct</span><span class="named-paragraph-number">5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP5_1" class="paragraph-anchor"></a><b>&#167;5.1. </b>Using a URL allows an instruction to refer to a symbol in another package.
If this has already been created, all well and good, but it may be a forward
reference, or even a reference to something in another tree which is to be
linked in later on. So if we see a URL which does not (yet) exist, we wire
a plug to it. For example, given <span class="extract"><span class="extract-syntax">/some/enchanted/evening</span></span>, we make a local
symbol <span class="extract"><span class="extract-syntax">evening ~~&gt; "/some/enchanted/evening"</span></span>. This is then fixed up when we
resolve forward references at the end of the parsing process &mdash; see below.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Search using URL conventions</span><span class="named-paragraph-number">5.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP19" class="function-link"><span class="function-syntax">InterSymbolsTable::URL_to_symbol</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><a href="2-st.html#SP3" class="function-link"><span class="function-syntax">InterSymbolsTable::package</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">)), </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::clear</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">) == </span><span class="constant-syntax">0</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"URL ends in '/'"</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">leaf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (!((</span><span class="identifier-syntax">S</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-tw2.html#SP7" class="function-link"><span class="function-syntax">Wiring::is_wired_to_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><a href="2-tw2.html#SP7" class="function-link"><span class="function-syntax">Wiring::wired_to_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">), </span><span class="identifier-syntax">name</span><span class="plain-syntax">)))) {</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP11" class="function-link"><span class="function-syntax">InterSymbolsTable::create_with_unique_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">leaf</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><a href="2-tw2.html#SP7" class="function-link"><span class="function-syntax">Wiring::wire_to_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">leaf</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP5">&#167;5</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP5_2" class="paragraph-anchor"></a><b>&#167;5.2. </b>This check is not foolproof. In particular, it is fooled by forward references.
But it really doesn't need to catch every possible error; this is Inter, not Inform.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Check that it is defined by the correct construct</span><span class="named-paragraph-number">5.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP18" class="function-link"><span class="function-syntax">InterSymbol::defined_elsewhere</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP9" class="function-link"><span class="function-syntax">InterSymbol::misc_but_undefined</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">D</span><span class="plain-syntax"> = </span><a href="2-sym.html#SP15" class="function-link"><span class="function-syntax">InterSymbol::definition</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">D</span><span class="plain-syntax">) &amp;&amp; (</span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::isnt</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">, </span><span class="identifier-syntax">construct</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">err</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::new</span><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">err</span><span class="plain-syntax">, </span><span class="string-syntax">"symbol has type %d not %d: "</span><span class="plain-syntax">, </span><a href="2-in.html#SP13" class="function-link"><span class="function-syntax">Inode::get_construct_ID</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">D</span><span class="plain-syntax">), </span><span class="identifier-syntax">construct</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP18" class="function-link"><span class="function-syntax">InterSymbolsTable::write_symbol_URL</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">err</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">err</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP5">&#167;5</a> and <a href="3-iitf.html#SP6">&#167;6</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP6" class="paragraph-anchor"></a><b>&#167;6. </b>This simpler version checks the global symbols for the tree, rather than the local
package, and does not allow URL references. (Of course they could only consist of
the same name with a single slash in front anyway, so this is no loss.) Here they
cannot be forward references to symbols not yet created.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::find_global_symbol</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="constant-syntax">inter_ti</span><span class="plain-syntax"> </span><span class="identifier-syntax">construct</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> **</span><span class="identifier-syntax">E</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax"> = </span><a href="2-it.html#SP3" class="function-link"><span class="function-syntax">InterTree::global_scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"no such symbol"</span><span class="plain-syntax">, </span><span class="identifier-syntax">name</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">construct</span><span class="plain-syntax"> != </span><span class="constant-syntax">0</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP5_2" class="named-paragraph-link"><span class="named-paragraph">Check that it is defined by the correct construct</span><span class="named-paragraph-number">5.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">S</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7" class="paragraph-anchor"></a><b>&#167;7. Forward references.</b>Because of the way we temporarily wire symbols to URLs when their references
cannot be resolved, the above process leaves us with a tree in which those
symbols are still left dangling. This is where we fix things:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::resolve_forward_references</span><button class="popup" onclick="togglePopup('usagePopup6')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup6">Usage of <span class="code-font"><span class="function-syntax">TextualInter::resolve_forward_references</span></span>:<br/><a href="3-iitf.html#SP1">&#167;1</a></span></button><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> </span><span class="identifier-syntax">eloc</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP2" class="function-link"><span class="function-syntax">InterErrors::file_location</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-it.html#SP8" class="function-link"><span class="function-syntax">InterTree::traverse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><a href="3-iitf.html#SP7" class="function-link"><span class="function-syntax">TextualInter::rfr_visitor</span></a><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::rfr_visitor</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> = </span><a href="4-tpc.html#SP9" class="function-link"><span class="function-syntax">PackageInstruction::at_this_head</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pack</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"no package defined here"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">T</span><span class="plain-syntax"> = </span><a href="2-pck.html#SP10" class="function-link"><span class="function-syntax">InterPackage::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">T</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) </span><span class="identifier-syntax">internal_error</span><span class="plain-syntax">(</span><span class="string-syntax">"package with no symbols"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="function-syntax">&lt;T-&gt;</span><span class="element-syntax">symbol_array_size</span><span class="plain-syntax">; </span><span class="identifier-syntax">i</span><span class="plain-syntax">++) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><span class="identifier-syntax">T</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">symbol_array</span><span class="plain-syntax">[</span><span class="identifier-syntax">i</span><span class="plain-syntax">];</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-tw2.html#SP7" class="function-link"><span class="function-syntax">Wiring::is_wired_to_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_plug</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP7_1" class="named-paragraph-link"><span class="named-paragraph">This is a forward reference wiring</span><span class="named-paragraph-number">7.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP7_1" class="paragraph-anchor"></a><b>&#167;7.1. </b>The unexpected case here is where our unresolved symbol <span class="extract"><span class="extract-syntax">S</span></span> is itself a socket,
having been declared by a line of Inter like
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    socket hypothetical ~~&gt; /ultima/thule</span>
</pre>
<p class="commentary">at a position in the text file where <span class="extract"><span class="extract-syntax">/ultima/thule</span></span> has not yet been defined.
This then becomes that most heretical thing, a socket wired to a name:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    socket hypothetical ~~&gt; </span><span class="string-syntax">"/ultima/thule"</span>
</pre>
<p class="commentary">...until we correct that heresy here by calling <a href="2-tw2.html#SP13" class="internal">Wiring::make_socket_to</a>.
(It was already a socket: but now it's a socket to <span class="extract"><span class="extract-syntax">S_to</span></span>.)
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">This is a forward reference wiring</span><span class="named-paragraph-number">7.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><a href="2-tw2.html#SP7" class="function-link"><span class="function-syntax">Wiring::wired_to_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S_to</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">) == </span><span class="character-syntax">'/'</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S_to</span><span class="plain-syntax"> = </span><a href="2-st.html#SP19" class="function-link"><span class="function-syntax">InterSymbolsTable::URL_to_symbol</span></a><span class="plain-syntax">(</span><a href="2-pck.html#SP4" class="function-link"><span class="function-syntax">InterPackage::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pack</span><span class="plain-syntax">), </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">S_to</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">T</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S_to</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><a href="3-ie.html#SP5" class="function-link"><span class="function-syntax">InterErrors::issue</span></a><span class="plain-syntax">(</span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"unable to locate symbol"</span><span class="plain-syntax">, </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-sym.html#SP13" class="function-link"><span class="function-syntax">InterSymbol::is_socket</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">))</span>
<span class="plain-syntax">        </span><a href="2-tw2.html#SP13" class="function-link"><span class="function-syntax">Wiring::make_socket_to</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">S_to</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span>
<span class="plain-syntax">        </span><a href="2-tw2.html#SP5" class="function-link"><span class="function-syntax">Wiring::wire_to</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">S_to</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP7">&#167;7</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP8" class="paragraph-anchor"></a><b>&#167;8. Writing textual inter.</b>This more or less reverses the above process. Note that we do not write the
<span class="extract"><span class="extract-syntax">version</span></span> pseudo-construct, which would indicate the version number of Inter
used; that's a bit of a choice, but in the end it makes testing slightly easier
if we don't, because otherwise many test cases would need changing whenever
<a href="1-tiv.html" class="internal">The Inter Version</a> does.
</p>

<p class="commentary">This is a point of difference with binary Inter files, though, which are all
required to embed their specification version numbers.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::writer</span><button class="popup" onclick="togglePopup('usagePopup7')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup7">Usage of <span class="code-font"><span class="function-syntax">TextualInter::writer</span></span>:<br/>Bytecode Module - <a href="1-bm.html#SP3_2">&#167;3.2</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">char</span><span class="plain-syntax"> *</span><span class="identifier-syntax">format_string</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">vI</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">vI</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP9" class="function-link"><span class="function-syntax">TextualInter::write</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">typedef</span><span class="plain-syntax"> </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">struct</span><span class="plain-syntax"> </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">to</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">filter</span><span class="plain-syntax">)(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *);</span>
<span class="plain-syntax">} </span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>The structure textual_write_state is private to this section.</li></ul>
<p class="commentary firstcommentary"><a id="SP9" class="paragraph-anchor"></a><b>&#167;9. </b>If the function <span class="extract"><span class="extract-syntax">filter</span></span> is provided then we only write those nodes passing
the filter test.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write</span><button class="popup" onclick="togglePopup('usagePopup8')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup8">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write</span></span>:<br/><a href="3-iitf.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> (*</span><span class="identifier-syntax">filter</span><span class="plain-syntax">)(</span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *)) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;no-inter&gt;\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">tws</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tws</span><span class="plain-syntax">.</span><span class="element-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">OUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tws</span><span class="plain-syntax">.</span><span class="element-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">filter</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-it.html#SP7" class="function-link"><span class="function-syntax">InterTree::traverse_root_only</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><a href="3-iitf.html#SP9" class="function-link"><span class="function-syntax">TextualInter::visitor</span></a><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">tws</span><span class="plain-syntax">, -</span><span class="constant-syntax">PACKAGE_IST</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="2-it.html#SP8" class="function-link"><span class="function-syntax">InterTree::traverse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><a href="3-iitf.html#SP9" class="function-link"><span class="function-syntax">TextualInter::visitor</span></a><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">tws</span><span class="plain-syntax">, </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_package</span><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_package</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pack</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">I</span><span class="plain-syntax"> == </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;no-inter&gt;\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">return</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax"> </span><span class="identifier-syntax">tws</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tws</span><span class="plain-syntax">.</span><span class="element-syntax">to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">OUT</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">tws</span><span class="plain-syntax">.</span><span class="element-syntax">filter</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><a href="2-it.html#SP8" class="function-link"><span class="function-syntax">InterTree::traverse</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><a href="3-iitf.html#SP9" class="function-link"><span class="function-syntax">TextualInter::visitor</span></a><span class="plain-syntax">, &amp;</span><span class="identifier-syntax">tws</span><span class="plain-syntax">, </span><span class="identifier-syntax">pack</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::visitor</span><span class="plain-syntax">(</span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">void</span><span class="plain-syntax"> *</span><span class="identifier-syntax">state</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax"> *</span><span class="identifier-syntax">tws</span><span class="plain-syntax"> = (</span><span class="reserved-syntax">textual_write_state</span><span class="plain-syntax"> *) </span><span class="identifier-syntax">state</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">tws</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">filter</span><span class="plain-syntax">) &amp;&amp; ((*(</span><span class="identifier-syntax">tws</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">filter</span><span class="plain-syntax">))(</span><span class="identifier-syntax">P</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ic.html#SP19" class="function-link"><span class="function-syntax">InterInstruction::write_construct_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">tws</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">to</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><a href="3-ie.html#SP5" class="function-link"><span class="function-syntax">InterErrors::issue</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">E</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP10" class="paragraph-anchor"></a><b>&#167;10. Utility functions for writing construct lines.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_symbol</span><button class="popup" onclick="togglePopup('usagePopup9')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup9">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_symbol</span></span>:<br/><a href="3-iitf.html#SP12_13">&#167;12.13</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="2-tw2.html#SP2" class="function-link"><span class="function-syntax">Wiring::is_wired</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><a href="2-st.html#SP18" class="function-link"><span class="function-syntax">InterSymbolsTable::write_symbol_URL</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="2-tw2.html#SP3" class="function-link"><span class="function-syntax">Wiring::cable_end</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%S"</span><span class="plain-syntax">, </span><a href="2-sym.html#SP19" class="function-link"><span class="function-syntax">InterSymbol::identifier</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">));</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;invalid-symbol&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_symbol_from</span><button class="popup" onclick="togglePopup('usagePopup10')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup10">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_symbol_from</span></span>:<br/><a href="3-iitf.html#SP13">&#167;13</a><br/>The Instance Construct - <a href="4-tic2.html#SP5">&#167;5</a><br/>The Permission Construct - <a href="4-tpc3.html#SP5">&#167;5</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP5">&#167;5</a><br/>The Typename Construct - <a href="4-ttc.html#SP5">&#167;5</a><br/>The Inv Construct - <a href="5-tic.html#SP8">&#167;8</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">field</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax"> = </span><a href="2-st.html#SP13" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_ID_not_following</span></a><span class="plain-syntax">(</span>
<span class="plain-syntax">        </span><a href="2-pck.html#SP12" class="function-link"><span class="function-syntax">InterPackage::scope_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">), </span><span class="identifier-syntax">P</span><span class="plain-syntax">-&gt;</span><span class="element-syntax">W</span><span class="plain-syntax">.</span><span class="element-syntax">instruction</span><span class="plain-syntax">[</span><span class="identifier-syntax">field</span><span class="plain-syntax">]);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP10" class="function-link"><span class="function-syntax">TextualInter::write_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP11" class="paragraph-anchor"></a><b>&#167;11. Notation for text literals.</b></p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_text</span><button class="popup" onclick="togglePopup('usagePopup11')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup11">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_text</span></span>:<br/><a href="3-iitf.html#SP12_3">&#167;12.3</a>, <a href="3-iitf.html#SP12_5">&#167;12.5</a>, <a href="3-iitf.html#SP12_7">&#167;12.7</a>, <a href="3-iitf.html#SP12_9">&#167;12.9</a>, <a href="3-iitf.html#SP12_11">&#167;12.11</a><br/>Annotations - <a href="2-ann.html#SP14">&#167;14</a><br/>Text Provenance - <a href="3-tp.html#SP6">&#167;6</a><br/>The Insert Construct - <a href="4-tic.html#SP5">&#167;5</a><br/>The Origin Construct - <a href="4-toc.html#SP5">&#167;5</a><br/>The Pragma Construct - <a href="4-tpc4.html#SP5">&#167;5</a><br/>The Splat Construct - <a href="5-tsc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="constant-syntax">9</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\\t"</span><span class="plain-syntax">); </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="constant-syntax">10</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\\n"</span><span class="plain-syntax">); </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\\\""</span><span class="plain-syntax">); </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'\\'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\\\\"</span><span class="plain-syntax">); </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PUT</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"\""</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::parse_literal_text</span><button class="popup" onclick="togglePopup('usagePopup12')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup12">Usage of <span class="code-font"><span class="function-syntax">TextualInter::parse_literal_text</span></span>:<br/><a href="3-iitf.html#SP12_4">&#167;12.4</a>, <a href="3-iitf.html#SP12_6">&#167;12.6</a>, <a href="3-iitf.html#SP12_8">&#167;12.8</a>, <a href="3-iitf.html#SP12_10">&#167;12.10</a>, <a href="3-iitf.html#SP12_12">&#167;12.12</a><br/>Annotations - <a href="2-ann.html#SP15">&#167;15</a><br/>The Insert Construct - <a href="4-tic.html#SP4">&#167;4</a><br/>The Pragma Construct - <a href="4-tpc4.html#SP4">&#167;4</a><br/>The Splat Construct - <a href="5-tsc.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">from</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">to</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">literal_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">pos</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">from</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">pos</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">to</span><span class="plain-syntax">)) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">literal_mode</span><span class="plain-syntax"> == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'\\'</span><span class="plain-syntax">) { </span><span class="identifier-syntax">literal_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">; </span><span class="reserved-syntax">continue</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><span class="identifier-syntax">c</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'\\'</span><span class="plain-syntax">: </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'"'</span><span class="plain-syntax">: </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'t'</span><span class="plain-syntax">: </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">9</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="character-syntax">'n'</span><span class="plain-syntax">: </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="constant-syntax">10</span><span class="plain-syntax">; </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::plain</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"no such backslash escape"</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::char_acceptable</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"bad character in text"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">PUT_TO</span><span class="plain-syntax">(</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">, </span><span class="identifier-syntax">c</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">literal_mode</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="identifier-syntax">Str::clear</span><span class="plain-syntax">(</span><span class="identifier-syntax">parsed_text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::char_acceptable</span><span class="plain-syntax">(</span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt; </span><span class="constant-syntax">0x20</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="constant-syntax">0x09</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> != </span><span class="constant-syntax">0x0a</span><span class="plain-syntax">)) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12" class="paragraph-anchor"></a><b>&#167;12. Notation for value pairs.</b>See <a href="3-ivp.html" class="internal">Inter Value Pairs</a>. The printing and parsing functions are shown here
in an interleaved form, to keep each notation together. Both have a simple
outer structure:
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_pair</span><button class="popup" onclick="togglePopup('usagePopup13')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup13">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_pair</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP7">&#167;7</a><br/>The Instance Construct - <a href="4-tic2.html#SP5">&#167;5</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP5">&#167;5</a><br/>The Variable Construct - <a href="4-tvc.html#SP5">&#167;5</a><br/>The Ref Construct - <a href="5-trc.html#SP5">&#167;5</a><br/>The Val Construct - <a href="5-tvc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> </span><span class="identifier-syntax">pair</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><a href="2-in.html#SP6" class="function-link"><span class="function-syntax">Inode::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">);</span>

<span class="plain-syntax">         </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP5" class="function-link"><span class="function-syntax">InterValuePairs::is_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))         </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_1" class="named-paragraph-link"><span class="named-paragraph">Print numeric literal syntax</span><span class="named-paragraph-number">12.1</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP7" class="function-link"><span class="function-syntax">InterValuePairs::is_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))           </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_3" class="named-paragraph-link"><span class="named-paragraph">Print text literal syntax</span><span class="named-paragraph-number">12.3</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP10" class="function-link"><span class="function-syntax">InterValuePairs::is_real</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))           </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_5" class="named-paragraph-link"><span class="named-paragraph">Print real literal syntax</span><span class="named-paragraph-number">12.5</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP12" class="function-link"><span class="function-syntax">InterValuePairs::is_singular_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">)) </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_7" class="named-paragraph-link"><span class="named-paragraph">Print singular dword syntax</span><span class="named-paragraph-number">12.7</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP12" class="function-link"><span class="function-syntax">InterValuePairs::is_plural_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))   </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_9" class="named-paragraph-link"><span class="named-paragraph">Print plural dword syntax</span><span class="named-paragraph-number">12.9</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP16" class="function-link"><span class="function-syntax">InterValuePairs::is_glob</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))           </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_11" class="named-paragraph-link"><span class="named-paragraph">Print glob syntax</span><span class="named-paragraph-number">12.11</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP18" class="function-link"><span class="function-syntax">InterValuePairs::is_undef</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))          </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_15" class="named-paragraph-link"><span class="named-paragraph">Print undef syntax</span><span class="named-paragraph-number">12.15</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP14" class="function-link"><span class="function-syntax">InterValuePairs::is_symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">))       </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_13" class="named-paragraph-link"><span class="named-paragraph">Print symbol name syntax</span><span class="named-paragraph-number">12.13</span></a></span>
<span class="plain-syntax">    </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"&lt;invalid-value-type&gt;"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="function-syntax">TextualInter::parse_pair</span><button class="popup" onclick="togglePopup('usagePopup14')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup14">Usage of <span class="code-font"><span class="function-syntax">TextualInter::parse_pair</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP6_3">&#167;6.3</a>, <a href="4-tcc2.html#SP6_4">&#167;6.4</a><br/>The Instance Construct - <a href="4-tic2.html#SP4_2">&#167;4.2</a><br/>The PropertyValue Construct - <a href="4-tpc7.html#SP4">&#167;4</a><br/>The Variable Construct - <a href="4-tvc.html#SP4">&#167;4</a><br/>The Ref Construct - <a href="5-trc.html#SP4">&#167;4</a><br/>The Val Construct - <a href="5-tvc.html#SP4">&#167;4</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">line</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_error_location</span><span class="plain-syntax"> *</span><span class="identifier-syntax">eloc</span><span class="plain-syntax">,</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_bookmark</span><span class="plain-syntax"> *</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type_wanted</span><span class="plain-syntax">, </span><span class="identifier-syntax">text_stream</span><span class="plain-syntax"> *</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_pair</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pair</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_symbols_table</span><span class="plain-syntax"> *</span><span class="identifier-syntax">scope</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_tree</span><span class="plain-syntax"> *</span><span class="identifier-syntax">I</span><span class="plain-syntax"> = </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::tree</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">);</span>

<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">first_char</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_first_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">last_char</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get_last_char</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">is_identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Characters::isalpha</span><span class="plain-syntax">(</span><span class="identifier-syntax">first_char</span><span class="plain-syntax">)) || (</span><span class="identifier-syntax">first_char</span><span class="plain-syntax"> == </span><span class="character-syntax">'_'</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">is_identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Characters::isalpha</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">Characters::isdigit</span><span class="plain-syntax">(</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">)) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) &amp;&amp;</span>
<span class="plain-syntax">                (</span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">) != </span><span class="character-syntax">'_'</span><span class="plain-syntax">))</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">is_identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> = -1, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax"> = -1;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">last_char</span><span class="plain-syntax"> == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">for</span><span class="plain-syntax"> (</span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">i</span><span class="plain-syntax">=0; </span><span class="identifier-syntax">i</span><span class="plain-syntax">&lt;</span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">); </span><span class="identifier-syntax">i</span><span class="plain-syntax">++)</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">i</span><span class="plain-syntax">) == </span><span class="character-syntax">'"'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> = </span><span class="identifier-syntax">i</span><span class="plain-syntax">+1;</span>
<span class="plain-syntax">                </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::len</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">)-2;</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">+1)</span>
<span class="plain-syntax">                    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"mismatched quotes"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            }</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">0</span><span class="plain-syntax">) == </span><span class="character-syntax">'#'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::get_at</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">) == </span><span class="character-syntax">'#'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">is_identifier</span><span class="plain-syntax"> = </span><span class="identifier-syntax">TRUE</span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_2" class="named-paragraph-link"><span class="named-paragraph">Parse numeric literal syntax</span><span class="named-paragraph-number">12.2</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_4" class="named-paragraph-link"><span class="named-paragraph">Parse text literal syntax</span><span class="named-paragraph-number">12.4</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_6" class="named-paragraph-link"><span class="named-paragraph">Parse real literal syntax</span><span class="named-paragraph-number">12.6</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_8" class="named-paragraph-link"><span class="named-paragraph">Parse singular dword syntax</span><span class="named-paragraph-number">12.8</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_10" class="named-paragraph-link"><span class="named-paragraph">Parse plural dword syntax</span><span class="named-paragraph-number">12.10</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_12" class="named-paragraph-link"><span class="named-paragraph">Parse glob syntax</span><span class="named-paragraph-number">12.12</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_14" class="named-paragraph-link"><span class="named-paragraph">Parse symbol name syntax</span><span class="named-paragraph-number">12.14</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_16" class="named-paragraph-link"><span class="named-paragraph">Parse undef syntax</span><span class="named-paragraph-number">12.16</span></a></span><span class="plain-syntax">;</span>

<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"unrecognised value"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">}</span>
</pre>
<p class="commentary firstcommentary"><a id="SP12_1" class="paragraph-anchor"></a><b>&#167;12.1. </b>Literal numbers can be parsed in (signed) decimal, (unsigned) hexadecimal
or (unsigned) binary, but cannot be printed back in binary.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print numeric literal syntax</span><span class="named-paragraph-number">12.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">switch</span><span class="plain-syntax"> (</span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::to_base</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">10</span><span class="plain-syntax">: </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"%d"</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::to_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">)); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">2</span><span class="plain-syntax">:</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">case</span><span class="plain-syntax"> </span><span class="constant-syntax">16</span><span class="plain-syntax">: </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"0x%x"</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::to_number</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">)); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">default:</span><span class="plain-syntax"> </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"???"</span><span class="plain-syntax">); </span><span class="reserved-syntax">break</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_2" class="paragraph-anchor"></a><b>&#167;12.2. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse numeric literal syntax</span><span class="named-paragraph-number">12.2</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">first_char</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> == </span><span class="character-syntax">'-'</span><span class="plain-syntax">) || (</span><span class="identifier-syntax">Characters::isdigit</span><span class="plain-syntax">(</span><span class="identifier-syntax">c</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">sign</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">, </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">unsigned</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">base</span><span class="plain-syntax"> = </span><span class="constant-syntax">10</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::prefix_eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"-"</span><span class="plain-syntax">, </span><span class="constant-syntax">1</span><span class="plain-syntax">)) { </span><span class="identifier-syntax">sign</span><span class="plain-syntax"> = -1; </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="constant-syntax">1</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::prefix_eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0b"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) { </span><span class="identifier-syntax">base</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">; </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::prefix_eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"0x"</span><span class="plain-syntax">, </span><span class="constant-syntax">2</span><span class="plain-syntax">)) { </span><span class="identifier-syntax">base</span><span class="plain-syntax"> = </span><span class="constant-syntax">16</span><span class="plain-syntax">; </span><span class="identifier-syntax">from</span><span class="plain-syntax"> = </span><span class="constant-syntax">2</span><span class="plain-syntax">; }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">LOOP_THROUGH_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax"> &lt; </span><span class="identifier-syntax">from</span><span class="plain-syntax">) </span><span class="reserved-syntax">continue</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">inchar32_t</span><span class="plain-syntax"> </span><span class="identifier-syntax">c</span><span class="plain-syntax"> = </span><span class="identifier-syntax">Str::get</span><span class="plain-syntax">(</span><span class="identifier-syntax">pos</span><span class="plain-syntax">), </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="constant-syntax">0</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'a'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'z'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-</span><span class="character-syntax">'a'</span><span class="plain-syntax">+10;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'A'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'Z'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-</span><span class="character-syntax">'A'</span><span class="plain-syntax">+10;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &gt;= </span><span class="character-syntax">'0'</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">c</span><span class="plain-syntax"> &lt;= </span><span class="character-syntax">'9'</span><span class="plain-syntax">)) </span><span class="identifier-syntax">d</span><span class="plain-syntax"> = </span><span class="identifier-syntax">c</span><span class="plain-syntax">-</span><span class="character-syntax">'0'</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"bad digit"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">d</span><span class="plain-syntax"> &gt; </span><span class="identifier-syntax">base</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"bad digit for this number base"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">            </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">base</span><span class="plain-syntax">*</span><span class="identifier-syntax">N</span><span class="plain-syntax"> + (</span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">long</span><span class="plain-syntax"> </span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">d</span><span class="plain-syntax">;</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">pos</span><span class="plain-syntax">.</span><span class="element-syntax">index</span><span class="plain-syntax"> &gt; </span><span class="constant-syntax">34</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"value out of range"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">N</span><span class="plain-syntax"> = </span><span class="identifier-syntax">sign</span><span class="plain-syntax">*</span><span class="identifier-syntax">N</span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">base</span><span class="plain-syntax"> == </span><span class="constant-syntax">10</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-idt.html#SP22" class="function-link"><span class="function-syntax">InterTypes::literal_is_in_range</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">type_wanted</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"value out of range"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> {</span>
<span class="plain-syntax">            </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-idt.html#SP22" class="function-link"><span class="function-syntax">InterTypes::unsigned_literal_is_in_range</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">type_wanted</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">)</span>
<span class="plain-syntax">                </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><a href="3-ie.html#SP4" class="function-link"><span class="function-syntax">InterErrors::quoted</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="string-syntax">"value out of range"</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        }</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">sign</span><span class="plain-syntax"> == -1) *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::signed_number</span></a><span class="plain-syntax">((</span><span class="reserved-syntax">int</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">else</span><span class="plain-syntax"> *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP4" class="function-link"><span class="function-syntax">InterValuePairs::number_in_base</span></a><span class="plain-syntax">((</span><span class="constant-syntax">inter_ti</span><span class="plain-syntax">) </span><span class="identifier-syntax">N</span><span class="plain-syntax">, </span><span class="identifier-syntax">base</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_3" class="paragraph-anchor"></a><b>&#167;12.3. </b>Literal text is written in double quotes: see the functions above for the
rules on escape characters inside.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print text literal syntax</span><span class="named-paragraph-number">12.3</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP6" class="function-link"><span class="function-syntax">InterValuePairs::to_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_4" class="paragraph-anchor"></a><b>&#167;12.4. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse text literal syntax</span><span class="named-paragraph-number">12.4</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">1</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP6" class="function-link"><span class="function-syntax">InterValuePairs::from_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_5" class="paragraph-anchor"></a><b>&#167;12.5. </b>Real numbers are written thus: <span class="extract"><span class="extract-syntax">r"3.14159"</span></span>.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print real literal syntax</span><span class="named-paragraph-number">12.5</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"r"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP9" class="function-link"><span class="function-syntax">InterValuePairs::to_textual_real</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_6" class="paragraph-anchor"></a><b>&#167;12.6. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse real literal syntax</span><span class="named-paragraph-number">12.6</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">2</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::begins_with_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"r"</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP9" class="function-link"><span class="function-syntax">InterValuePairs::real_from_I6_notation</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_7" class="paragraph-anchor"></a><b>&#167;12.7. </b>Dictionary words are like literal text, but prefaced by <span class="extract"><span class="extract-syntax">dw</span></span> or <span class="extract"><span class="extract-syntax">dwp</span></span>. For
example, <span class="extract"><span class="extract-syntax">dw"xyzzy"</span></span> or <span class="extract"><span class="extract-syntax">dwp"fruits"</span></span>.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print singular dword syntax</span><span class="named-paragraph-number">12.7</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"dw"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP11" class="function-link"><span class="function-syntax">InterValuePairs::to_dictionary_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_8" class="paragraph-anchor"></a><b>&#167;12.8. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse singular dword syntax</span><span class="named-paragraph-number">12.8</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">3</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::begins_with_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"dw"</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP11" class="function-link"><span class="function-syntax">InterValuePairs::from_singular_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_9" class="paragraph-anchor"></a><b>&#167;12.9. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print plural dword syntax</span><span class="named-paragraph-number">12.9</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"dwp"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP11" class="function-link"><span class="function-syntax">InterValuePairs::to_dictionary_word</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_10" class="paragraph-anchor"></a><b>&#167;12.10. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse plural dword syntax</span><span class="named-paragraph-number">12.10</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">4</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::begins_with_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"dwp"</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP11" class="function-link"><span class="function-syntax">InterValuePairs::from_plural_dword</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_11" class="paragraph-anchor"></a><b>&#167;12.11. </b>Globs should never be talked about at all, but if they were, they would be
written <span class="extract"><span class="extract-syntax">glob"..."</span></span>, with the same escaping rules as literal text.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print glob syntax</span><span class="named-paragraph-number">12.11</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"glob"</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::write_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><a href="3-ivp.html#SP15" class="function-link"><span class="function-syntax">InterValuePairs::to_glob_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">pair</span><span class="plain-syntax">));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_12" class="paragraph-anchor"></a><b>&#167;12.12. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse glob syntax</span><span class="named-paragraph-number">12.12</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> ((</span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax"> == </span><span class="constant-syntax">5</span><span class="plain-syntax">) &amp;&amp; (</span><span class="identifier-syntax">Str::begins_with_wide_string</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">U</span><span class="string-syntax">"glob"</span><span class="plain-syntax">))) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">TEMPORARY_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> =</span>
<span class="plain-syntax">            </span><a href="3-iitf.html#SP11" class="function-link"><span class="function-syntax">TextualInter::parse_literal_text</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_from</span><span class="plain-syntax">, </span><span class="identifier-syntax">quoted_to</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP15" class="function-link"><span class="function-syntax">InterValuePairs::glob</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">text</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">DISCARD_TEXT</span><span class="plain-syntax">(</span><span class="identifier-syntax">text</span><span class="plain-syntax">)</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_13" class="paragraph-anchor"></a><b>&#167;12.13. </b>Symbol names can either be bare identifiers, in the current package, or can be
given as URLs. Note that they are created tentatively if they do not already exist,
in order for forward references to be read in by a one-pass assembler such as the
one above.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print symbol name syntax</span><span class="named-paragraph-number">12.13</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><a href="3-iitf.html#SP10" class="function-link"><span class="function-syntax">TextualInter::write_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">,</span>
<span class="plain-syntax">        </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::to_symbol_not_following</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">pair</span><span class="plain-syntax">, </span><a href="2-pck.html#SP12" class="function-link"><span class="function-syntax">InterPackage::scope_of</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">)));</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_14" class="paragraph-anchor"></a><b>&#167;12.14. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse symbol name syntax</span><span class="named-paragraph-number">12.14</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">first_char</span><span class="plain-syntax"> == </span><span class="character-syntax">'/'</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">symb</span><span class="plain-syntax"> = </span><a href="2-st.html#SP20" class="function-link"><span class="function-syntax">InterSymbolsTable::wire_to_URL</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">I</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">));</span>
<span class="plain-syntax">        </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_14_1" class="named-paragraph-link"><span class="named-paragraph">Use this symb as the result</span><span class="named-paragraph-number">12.14.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">is_identifier</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">inter_symbol</span><span class="plain-syntax"> *</span><span class="identifier-syntax">symb</span><span class="plain-syntax"> = </span><a href="2-st.html#SP7" class="function-link"><span class="function-syntax">InterSymbolsTable::symbol_from_name</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">scope</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">symb</span><span class="plain-syntax">) </span><span class="named-paragraph-container code-font"><a href="3-iitf.html#SP12_14_1" class="named-paragraph-link"><span class="named-paragraph">Use this symb as the result</span><span class="named-paragraph-number">12.14.1</span></a></span><span class="plain-syntax">;</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">symb</span><span class="plain-syntax"> = </span><a href="2-st.html#SP11" class="function-link"><span class="function-syntax">InterSymbolsTable::create_with_unique_name</span></a><span class="plain-syntax">(</span><a href="2-bkm.html#SP7" class="function-link"><span class="function-syntax">InterBookmark::scope</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">), </span><span class="identifier-syntax">S</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">symb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><a href="2-sym.html#SP6" class="function-link"><span class="function-syntax">InterSymbol::set_flag</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">symb</span><span class="plain-syntax">, </span><span class="constant-syntax">SPECULATIVE_ISYMF</span><span class="plain-syntax">);</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_14_1" class="paragraph-anchor"></a><b>&#167;12.14.1. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Use this symb as the result</span><span class="named-paragraph-number">12.14.1</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">symbol_type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP24" class="function-link"><span class="function-syntax">InterTypes::of_symbol</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">symb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_error_message</span><span class="plain-syntax"> *</span><span class="identifier-syntax">E</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP23" class="function-link"><span class="function-syntax">InterTypes::can_be_used_as</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">symbol_type</span><span class="plain-syntax">, </span><span class="identifier-syntax">type_wanted</span><span class="plain-syntax">, </span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">eloc</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">E</span><span class="plain-syntax">) </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">E</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP13" class="function-link"><span class="function-syntax">InterValuePairs::symbolic</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">IBM</span><span class="plain-syntax">, </span><span class="identifier-syntax">symb</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12_14">&#167;12.14</a> (twice).</li></ul>
<p class="commentary firstcommentary"><a id="SP12_15" class="paragraph-anchor"></a><b>&#167;12.15. </b>Note that the undef syntax is not a valid identifier, since it begins <span class="extract"><span class="extract-syntax">!</span></span>.
This choice of character is meant to give it a dangerous aspect.
</p>

<p class="commentary"><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Print undef syntax</span><span class="named-paragraph-number">12.15</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"!undef"</span><span class="plain-syntax">);</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP12_16" class="paragraph-anchor"></a><b>&#167;12.16. </b><span class="named-paragraph-container code-font"><span class="named-paragraph-defn">Parse undef syntax</span><span class="named-paragraph-number">12.16</span></span><span class="comment-syntax"> =</span>
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">Str::eq</span><span class="plain-syntax">(</span><span class="identifier-syntax">S</span><span class="plain-syntax">, </span><span class="identifier-syntax">I</span><span class="string-syntax">"!undef"</span><span class="plain-syntax">)) {</span>
<span class="plain-syntax">        *</span><span class="identifier-syntax">pair</span><span class="plain-syntax"> = </span><a href="3-ivp.html#SP17" class="function-link"><span class="function-syntax">InterValuePairs::undef</span></a><span class="plain-syntax">();</span>
<span class="plain-syntax">        </span><span class="reserved-syntax">return</span><span class="plain-syntax"> </span><span class="identifier-syntax">NULL</span><span class="plain-syntax">;</span>
<span class="plain-syntax">    }</span>
</pre>
<ul class="endnotetexts"><li>This code is used in <a href="3-iitf.html#SP12">&#167;12</a>.</li></ul>
<p class="commentary firstcommentary"><a id="SP13" class="paragraph-anchor"></a><b>&#167;13. Bracketed type markers.</b>The following prints out the bracketed type markers used in textual Inter,
but printing nothing in the case where the type is unchecked and the value is
therefore used typelessly.
</p>

<pre class="displayed-code all-displayed-code code-font">
<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_optional_type_marker</span><button class="popup" onclick="togglePopup('usagePopup15')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup15">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_optional_type_marker</span></span>:<br/>The Constant Construct - <a href="4-tcc2.html#SP7">&#167;7</a><br/>The Package Construct - <a href="4-tpc.html#SP7">&#167;7</a><br/>The Property Construct - <a href="4-tpc6.html#SP5">&#167;5</a><br/>The Variable Construct - <a href="4-tvc.html#SP5">&#167;5</a><br/>The Local Construct - <a href="5-tlc3.html#SP5">&#167;5</a><br/>The Ref Construct - <a href="5-trc.html#SP5">&#167;5</a><br/>The Val Construct - <a href="5-tvc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">field</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP14" class="function-link"><span class="function-syntax">InterTypes::from_TID_in_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">field</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax">.</span><span class="element-syntax">type_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"("</span><span class="plain-syntax">); </span><a href="3-iitf.html#SP10" class="function-link"><span class="function-syntax">TextualInter::write_symbol_from</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">field</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">") "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-idt.html#SP12" class="function-link"><span class="function-syntax">InterTypes::is_unchecked</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">"("</span><span class="plain-syntax">); </span><a href="3-idt.html#SP20" class="function-link"><span class="function-syntax">InterTypes::write_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">); </span><span class="identifier-syntax">WRITE</span><span class="plain-syntax">(</span><span class="string-syntax">") "</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>

<span class="reserved-syntax">void</span><span class="plain-syntax"> </span><span class="function-syntax">TextualInter::write_compulsory_type_marker</span><button class="popup" onclick="togglePopup('usagePopup16')"><span class="comment-syntax">?</span><span class="popuptext" id="usagePopup16">Usage of <span class="code-font"><span class="function-syntax">TextualInter::write_compulsory_type_marker</span></span>:<br/>The Cast Construct - <a href="5-tcc.html#SP5">&#167;5</a></span></button><span class="plain-syntax">(</span><span class="identifier-syntax">OUTPUT_STREAM</span><span class="plain-syntax">, </span><span class="reserved-syntax">inter_tree_node</span><span class="plain-syntax"> *</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="reserved-syntax">int</span><span class="plain-syntax"> </span><span class="identifier-syntax">field</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">inter_type</span><span class="plain-syntax"> </span><span class="identifier-syntax">type</span><span class="plain-syntax"> = </span><a href="3-idt.html#SP14" class="function-link"><span class="function-syntax">InterTypes::from_TID_in_field</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">field</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><span class="identifier-syntax">type</span><span class="plain-syntax">.</span><span class="element-syntax">type_name</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="3-iitf.html#SP10" class="function-link"><span class="function-syntax">TextualInter::write_symbol_from</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">P</span><span class="plain-syntax">, </span><span class="identifier-syntax">field</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    } </span><span class="reserved-syntax">else</span><span class="plain-syntax"> </span><span class="reserved-syntax">if</span><span class="plain-syntax"> (</span><a href="3-idt.html#SP12" class="function-link"><span class="function-syntax">InterTypes::is_unchecked</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">type</span><span class="plain-syntax">) == </span><span class="identifier-syntax">FALSE</span><span class="plain-syntax">) {</span>
<span class="plain-syntax">        </span><a href="3-idt.html#SP20" class="function-link"><span class="function-syntax">InterTypes::write_type</span></a><span class="plain-syntax">(</span><span class="identifier-syntax">OUT</span><span class="plain-syntax">, </span><span class="identifier-syntax">type</span><span class="plain-syntax">);</span>
<span class="plain-syntax">    }</span>
<span class="plain-syntax">}</span>
</pre>
<nav role="progress"><div class="progresscontainer">
    <ul class="progressbar"><li class="progressprev"><a href="3-iibf.html">&#10094;</a></li><li class="progresschapter"><a href="P-wtmd.html">P</a></li><li class="progresschapter"><a href="1-bm.html">1</a></li><li class="progresschapter"><a href="2-it.html">2</a></li><li class="progresscurrentchapter">3</li><li class="progresssection"><a href="3-ic.html">ic</a></li><li class="progresssection"><a href="3-iibf.html">iibf</a></li><li class="progresscurrent">iitf</li><li class="progresssection"><a href="3-vi.html">vi</a></li><li class="progresssection"><a href="3-ivp.html">ivp</a></li><li class="progresssection"><a href="3-idt.html">idt</a></li><li class="progresssection"><a href="3-mtd.html">mtd</a></li><li class="progresssection"><a href="3-ie.html">ie</a></li><li class="progresssection"><a href="3-tp.html">tp</a></li><li class="progresschapter"><a href="4-tcc.html">4</a></li><li class="progresschapter"><a href="5-tac.html">5</a></li><li class="progresschapter"><a href="6-tpc.html">6</a></li><li class="progressnext"><a href="3-vi.html">&#10095;</a></li></ul></div>
</nav><!-- End of weave -->

		</main>
	</body>
</html>

